package com.atguigu.spzx.cloud.order.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
@LoadBalancerClients(value = {
        @LoadBalancerClient(name = "spzx-cloud-uxer", configuration = CustomLoadBalancerConfiguration.class)
})
public class RestTemplateConfiguration {

    @LoadBalanced//负载均衡,既可以远程调用,也可以本地调用
    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

}